﻿package com.wandian.view.mediator
{
	import com.wandian.controller.BuyInCommand;
	import com.wandian.controller.CLZNoticeName;
	import com.wandian.controller.SetRoomCommand;
	import com.wandian.data.GameData;
	import com.wandian.model.InRoomPlayerDataProxy;
	import com.wandian.model.SwfDataProxy;
	import com.wandian.model.vo.PlayerVo;
	import com.wandian.model.vo.RoomVo;
	import com.wandian.util.CLZButton;
	import com.wandian.util.GlowFilterManage;
	import com.wandian.util.GolbalTimer;
	import com.wandian.view.components.ui.GR;
	import com.wandian.view.components.ui.MaskTipPanel;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import org.puremvc.as3.interfaces.*;
	import org.puremvc.as3.patterns.mediator.*;

	/**
	 * 游戏房间内
	 * @author long
	 * @Create  2012-10-22
	 * @QQ 108232706
	 * @version 1.0
	 *_mcRoomTip房间名字，大小盲信息
	 * flManage_mc
	 * systemChat_mc 系统消息,操作提示，聊天显示
	 * mc_seat 9个红色的坐位
	 * illumination_mc9个照明灯
	 * dealManage_mc 9个桌面牌card*_1,card*_2 加女人旁边的cardBack
	 * publicCard_mc 5张公共牌card1-card5
	 * mc_banker 显示庄家的D图标 banker1-banker5
	 * chipManage_mc sitChip1-9游戏桌下注的钱显示的位置，xy1-9钱动画的开始点，bonusPool1-8边池{BonusPool.txt：边池金额}
	 * control_mc 游戏内提示操作4个按钮，包括快速快速
	 * playerGift_mc 人物旁边,小按钮，点击进入商城
	 * players_mc，玩家姓名及本桌身上财富及操作状态
	 * chatTip_mc cardType1-9，聊天内容显示图标，以及提示牌型】
	 * btn_bag 个人背包按钮
	 * btn_bank 银行按钮
	 * btn_upGame 上一局回顾按钮，显示一张结果的截图
	 * btn_friend 显示牌友的按钮
	 * btn_shop 商城按钮
	 * bnt_stand 站起来按钮
	 * close_btn 退出房间按钮
	 * horn_btn 发喇叭按钮，整个服都收到
	 * face_btn 发表情按钮,分金币与vip两类
	 * cardHelp_btn 牌型大小帮助
	 * sgj_btn 摇奖按钮
	 * online_btn 在线摇奖按钮
	 * paybag_btn，red_btn 红包，activity_btn邀请好友
	 * animation_mc 点快速快速按钮后=>系统提示你当前坐位的方向动作,arrow1-9 You，xy1-9,axy1-9
	 * notice_mc
	 * onlineTip_mc  在线时间提示
	 * 其他游戏内动画：WinTip，赢了动画，VIP标识，Chips[5-20-]钱币
	 * CardTypeTipPanel，牌型提示帮助
	 * CardNumBlack1，CardNumBlack，黑色1-K；CardNum，CardNum1红色1-K，CardHuaSe四个花色
	*/
	public class GameRoomMediator extends Mediator
	{
		private var _global:GameData;
		/**
		 * 庄家Id
		 * @default
		 */
		private var _nDealerId:int;
		/**
		 * 房间是否正在玩游戏
		 * @default
		 */
		private var _isPlaying:int;
		private var _bitmapData:BitmapData;
		private var _mcUpGame:Sprite;
		private var _filter:GlowFilterManage;
		private var _inRoomData:InRoomPlayerDataProxy;
		private var maskTip_mc:MaskTipPanel;
		private var _globalTimer:GolbalTimer;
		private var _arrBtnX:Array;
		private var _arrBtn:Array;
		public static const NAME:String="GameRoomMediator";

		public function GameRoomMediator(viewComponent:Object=null)
		{
			this._global=GameData.getInstance();
			this._filter=GlowFilterManage.getInstance();
			this._globalTimer=GolbalTimer.getInstance();
			this._arrBtnX=[6, 48.45, 90.4, 132, 174.1];
			this._arrBtn=[];
			super(NAME, viewComponent);
			this._inRoomData=facade.retrieveProxy(InRoomPlayerDataProxy.NAME) as InRoomPlayerDataProxy;
			return;
		}

		override public function onRegister():void
		{
			updateRoomInfo();
			this._mcUpGame=new Sprite();
			this.registerMcEvent();
			this.initOnlineBtn();
			this.onlineFun();
			return;
		}

		public override function onRemove():void
		{
			removeRegisterMcEvent();
		}


		private function updateRoomInfo():void
		{
			var roomVo:RoomVo=GameData._objRoom;
//			var roomType:*=this._global.judgeMoneyType(roomVo.type) == 0 ? (GameData.tip["MONEY"]) : (GameData.tip["GOLD"]);
			this.mcGameMain._mcRoomTip.roomName_txt.text=roomVo.roomCode + roomVo.name + "\t";
			this.mcGameMain._mcRoomTip.stake_txt.text=GameData.tip["STAKE_BANK"] + "：" + this._global.counstK(roomVo.minStake) + "/" + this._global.counstK(roomVo.maxStake);
			this.mcGameMain._mcRoomTip.blind_txt.text=GameData.tip["ROOM_BLIND"] + "：" + this._global.counstK(roomVo.minBlind) + "/" + this._global.counstK(roomVo.maxblind);
		}

		/**
		 * 注册游戏内事件
		 */
		private function registerMcEvent():void
		{
			this.maskTip_mc=new MaskTipPanel();
			this.maskTip_mc.x=479.5;
			this.maskTip_mc.y=314.55;
			this.mcGameMain.addChild(this.maskTip_mc);
			facade.registerMediator(new MaskGameMediator(this.maskTip_mc));
			facade.registerMediator(new PlayerMediator(this.mcGameMain.players_mc, this.mcGameMain.flManage_mc));
			facade.registerMediator(new DealCardMediator(this.mcGameMain.dealManage_mc));
			facade.registerCommand(CLZNoticeName.BUY_IN_WINDOS_SHOW, BuyInCommand);
			facade.registerCommand(CLZNoticeName.SET_ROOM_WINDOS_SHOW, SetRoomCommand);
			facade.registerMediator(new BroadcastNoticeMediator(this.mcGameMain.notice_mc));
			facade.registerMediator(new OperateMediator(this.mcGameMain.control_mc));
			facade.registerMediator(new PublicCardMediator(this.mcGameMain.publicCard_mc));
			facade.registerMediator(new ChipMediator(this.mcGameMain.chipManage_mc));
			facade.registerMediator(new DealerMediator(this.mcGameMain.mc_banker));
			facade.registerMediator(new ChatTipMediator(this.mcGameMain.chatTip_mc));
			facade.registerMediator(new SystemChatMediators(this.mcGameMain.systemChat_mc));
			facade.registerMediator(new GameGiftMediator(this.mcGameMain.playerGift_mc));
			facade.registerMediator(new IlluminationMediator(this.mcGameMain.illumination_mc));
			facade.registerMediator(new AnimationMediator(this.mcGameMain.animation_mc));
			facade.registerMediator(new SeatMediator(this.mcGameMain.mc_seat));
			this.mcGameMain.btn_friend.addEventListener(MouseEvent.CLICK, this.onFriendHandler);
			this.mcGameMain.btn_upGame.addEventListener(MouseEvent.CLICK, this.onUpGameHandler);
			_mcGameRecord=new GR();
			Texas.I._mcWindosView.addChild(_mcGameRecord);
			_mcGameRecord.visible=false;
			this.mcGameMain.btn_bank.addEventListener(MouseEvent.CLICK, this.onBankHandler);
			this.mcGameMain.btn_bag.addEventListener(MouseEvent.CLICK, this.onBagHandler);
			this.mcGameMain.btn_shop.addEventListener(MouseEvent.CLICK, this.onShopHandler);
			this.mcGameMain.horn_btn.addEventListener(MouseEvent.CLICK, this.onHornHandler);
			this.mcGameMain.face_btn.addEventListener(MouseEvent.CLICK, this.onFaceHandler);
			this._mcUpGame.addEventListener(MouseEvent.CLICK, this.onCloseBitmapHandler);
			hideComponent();
			CLZButton.setButton(this.mcGameMain.btn_friend, "", {tip: GameData.tip["FRIEND_NAME"], time: 10, pointXY: {disX: 0, disY: -30}});
			CLZButton.setButton(this.mcGameMain.btn_upGame, "", {tip: GameData.tip["PREV_GAME_SHOW_CARD"], time: 10, pointXY: {disX: 0, disY: -30}});
			CLZButton.setButton(this.mcGameMain.btn_bank, "", {tip: GameData.tip["BANK_NAME"], time: 10, pointXY: {disX: 0, disY: -30}});
			CLZButton.setButton(this.mcGameMain.btn_bag, "", {tip: GameData.tip["BAG_NAME"], time: 10, pointXY: {disX: 0, disY: -30}});
			CLZButton.setButton(this.mcGameMain.btn_shop, "", {tip: GameData.tip["SHOP"], time: 10, pointXY: {disX: 0, disY: -30}});
			CLZButton.setButton(this.mcGameMain.bnt_stand, "", {tip: GameData.tip["STAND_UP_NAME"], time: 500, pointXY: {disX: 0, disY: 30}});
			CLZButton.setButton(this.mcGameMain.close_btn, "", {tip: GameData.tip["RETURN_ROOM_LIST"], time: 500, pointXY: {disX: 0, disY: 30}});
			CLZButton.setButton(this.mcGameMain.face_btn, "", {tip: GameData.tip["FACE_NAME"], time: 10, pointXY: {disX: 0, disY: -20}});
			CLZButton.setButton(this.mcGameMain.horn_btn, "", {tip: GameData.tip["HORN_NAME"], time: 10, pointXY: {disX: 0, disY: -20}});
			CLZButton.setButton(this.mcGameMain.cardHelp_btn, GameData.tip["CARD_SORT_MAX_MIN"]);
			CLZButton.setButton(this.mcGameMain.sgj_btn, "", {tip: GameData.tip["MAX_WIN_NAME"], time: 10});
			CLZButton.setButton(this.mcGameMain.online_btn, "", {tip: GameData.tip["ONLINE_REWARD_NAME"], time: 10});
//			CLZButton.setButton(this.mcGameMain.paybag_btn, "", {tip: GameData.tip["PAY_PAG_BTN_TIP"], time: 10});
			CLZButton.setButton(this.mcGameMain.red_btn, "", {tip: GameData.tip["RED_PAG_BTN_TIP"], time: 10});
//			CLZButton.setButton(this.mcGameMain.activity_btn, "", {tip: GameData.tip["ACTIVITY_BTN_TIP"], time: 10});
			this.mcGameMain.bnt_stand.visible=false;
			this.mcGameMain.bnt_stand.addEventListener(MouseEvent.CLICK, this.onStandHandler);
			this.mcGameMain.close_btn.addEventListener(MouseEvent.CLICK, this.onCloseHandler);
			this.mcGameMain._mcRoomTip.addEventListener(MouseEvent.ROLL_OVER, this.overRoomTipHandler);
			this.mcGameMain._mcRoomTip.addEventListener(MouseEvent.ROLL_OUT, this.outRoomTipHandler);
			this.mcGameMain.cardHelp_btn.addEventListener(MouseEvent.CLICK, this.showCardHelpTip);
			this.mcGameMain.sgj_btn.addEventListener(MouseEvent.CLICK, this.onSGJHandler);
			this.mcGameMain.online_btn.addEventListener(MouseEvent.CLICK, this.onOnlineRewardHandler);
			this.mcGameMain.onlineTip_mc.addEventListener(MouseEvent.CLICK, this.onOnlineRewardHandler);
			this.mcGameMain.red_btn.addEventListener(MouseEvent.CLICK, this.onRedBagHandler);
//			this.mcGameMain.activity_btn.addEventListener(MouseEvent.CLICK, this.onActivityHandler);
//			if (this._global.userInfo.userVo.isopen)
//			{
//				this.mcGameMain.paybag_btn.visible=true;
//			}
//			else
//			{
//				this.mcGameMain.paybag_btn.visible=false;
//			}
			this.mcGameMain.removeChild(this.mcGameMain.paybag_btn);
			this.mcGameMain.removeChild(this.mcGameMain.share_btn);
			this.mcGameMain.removeChild(this.mcGameMain.online_btn);
			this.mcGameMain.removeChild(this.mcGameMain.onlineTip_mc);
			this.mcGameMain.removeChild(this.mcGameMain.red_btn);
			this.mcGameMain.removeChild(this.mcGameMain.holiday_btn);
//			if (this._global.userInfo.userVo.isInviteopen)
//			{
//				this.mcGameMain.activity_btn.visible=true;
//			}
//			else
//			{
//				this.mcGameMain.activity_btn.visible=false;
//			}
			this.mcGameMain.removeChild(this.mcGameMain.activity_btn);
//			this.mcGameMain.paybag_btn.addEventListener(MouseEvent.CLICK, this.onPayBagHandler);
//			this.mcGameMain.onlineTip_mc.mouseChildren=false;
//			this.mcGameMain.onlineTip_mc.buttonMode=true;

//			if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
//			{
//				this.mcGameMain.sgj_btn.visible=false;
//				this.mcGameMain.online_btn.visible=false;
//				this.mcGameMain.onlineTip_mc.visible=false;
//			}
//			if (this._global.userInfo.userVo.gp == GameData.QZONE_SID)
//			{
//				this.mcGameMain.sgj_btn.visible=false;
//			}
			//小按钮隐藏掉
//			this._arrBtn=[this.mcGameMain.online_btn, this.mcGameMain.paybag_btn, this.mcGameMain.sgj_btn, this.mcGameMain.red_btn, this.mcGameMain.activity_btn];
			this.sortBtnX();
			return;
		}

		private function hideComponent():void
		{
			this.mcGameMain.share_btn.visible=false;
			this.mcGameMain.sgj_btn.visible=false;
			this.mcGameMain.online_btn.visible=false;
			this.mcGameMain.onlineTip_mc.visible=false;
			this.mcGameMain.red_btn.visible=false;
			this.mcGameMain.holiday_btn.visible=false;
		}

		private function removeRegisterMcEvent():void
		{
			facade.sendNotification(CLZNoticeName.OUT_GAME_ROOM_REMOVE);
			facade.removeMediator(BroadcastNoticeMediator.NAME);
			facade.removeMediator(PlayerMediator.NAME);
			facade.removeMediator(DealCardMediator.NAME);
			facade.removeMediator(SeatMediator.NAME);
			facade.removeMediator(PublicCardMediator.NAME);
			facade.removeMediator(ChipMediator.NAME);
			facade.removeMediator(DealerMediator.NAME);
			facade.removeMediator(MaskGameMediator.NAME);
//			facade.removeMediator(PlayerMediator.NAME);
			facade.removeMediator(SystemChatMediators.NAME);
			facade.removeMediator(OperateMediator.NAME);
			facade.removeMediator(GameGiftMediator.NAME);
			facade.removeMediator(IlluminationMediator.NAME);
			facade.removeMediator(ChatTipMediator.NAME);
			facade.removeCommand(CLZNoticeName.BUY_IN_WINDOS_SHOW);
			facade.removeCommand(CLZNoticeName.SET_ROOM_WINDOS_SHOW);
			facade.removeMediator(AnimationMediator.NAME);
			this.sendNotification(CLZNoticeName.HIDE_ACCOUNT);
			this.sendNotification(CLZNoticeName.HIDE_SHOPING);
			this.sendNotification(CLZNoticeName.HIDE_USE_SELECTED_TIP);
			this.mcGameMain.bnt_stand.removeEventListener(MouseEvent.CLICK, this.onStandHandler);
			this.mcGameMain.close_btn.removeEventListener(MouseEvent.CLICK, this.onCloseHandler);
			return;
		}

		private function onStandHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.STAND_UP, {seatId: this._global.seatId});
			return;
		}

		private function onCloseHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.OUT_GAME_ROOM, {seatId: this._global.seatId});
			return;
		}

		private function onFriendHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_FRIEND_PANEL);
			return;
		}

		private var _mcGameRecord:Sprite;

		private function onUpGameHandler(event:MouseEvent):void
		{
			_mcGameRecord.visible=!_mcGameRecord.visible;
			/*GameData.removeNumChildre(this._mcUpGame);
			if (this._bitmapData == null)
			{
				this.sendNotification(CLZNoticeName.SHOW_MOVE_TIP, {tip: GameData.tip["NOT_UP_GAME_BITMAP"]});
				return;
			}
			var _loc_2:*=new Bitmap(this._bitmapData);
			this._mcUpGame.addChild(_loc_2);
			var _loc_3:*=new TextField();
			_loc_3.text=GameData.tip["UP_GAME_TIP"];
			_loc_3.autoSize=TextFieldAutoSize.CENTER;
			_loc_3.width=200;
			var _loc_4:*=new TextFormat();
			_loc_4.size=25;
			_loc_4.color=16711680;
			_loc_4.bold=true;
			_loc_3.setTextFormat(_loc_4);
			_loc_3.x=(GameData.config["stageW"] - _loc_3.width) * 0.5;
			_loc_3.y=20;
			this._mcUpGame.addChild(_loc_3);
			Texas.I._mcWindosView.addChild(this._mcUpGame);
			this._mcUpGame.filters=[this._filter.getUpGame()];*/
			return;
		}

		private function onCloseBitmapHandler(event:MouseEvent):void
		{
			if (this._mcUpGame != null)
			{
			}
			if (Texas.I._mcWindosView.contains(this._mcUpGame))
			{
				Texas.I._mcWindosView.removeChild(this._mcUpGame);
			}
			return;
		}

		private function onBankHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_BANK_PANEL_REQ);
			return;
		}

		private function onBagHandler(event:MouseEvent):void
		{
			return;
			var _loc_2:*=this._inRoomData.getInRoomPlayer(this._global.userInfo.userVo.userid);
			this.sendNotification(CLZNoticeName.USEPROPS_BTN, _loc_2);
			return;
		}

		private function onShopHandler(event:MouseEvent):void
		{
			return;
			var _loc_2:*=new PlayerVo();
			_loc_2=GameData.copyClass(this._global.userInfo.userVo, _loc_2) as PlayerVo;
			if (this._global.userInfo.userVo.gp != GameData.QZONE_SID)
			{
			}
			if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
			{
				this.sendNotification(CLZNoticeName.SHOW_SHOPING_VIP, _loc_2);
			}
			else
			{
				this.sendNotification(CLZNoticeName.SHOW_SHOPING_HOT_PROP, _loc_2);
			}
			return;
		}

		private function onHornHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_HORN_PANEL);
			return;
		}

		private function onFaceHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_FACE_PANEL);
			return;
		}

		private function showCardHelpTip(event:MouseEvent):void
		{
			this.mcGameMain.cardHelp_btn.visible=false;
			this.sendNotification(CLZNoticeName.SHOW_CARD_RANK_TIP);
			return;
		}

		private function onSGJHandler(event:MouseEvent):void
		{
			var _loc_2:*=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			_loc_2.singleLoadSWF("sgj_game", CLZNoticeName.SHOW_OPEN_SGJ_PANEL);
			return;
		}

		private function onOnlineRewardHandler(event:MouseEvent):void
		{
			var _loc_2:*=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			_loc_2.singleLoadSWF("zp_game", CLZNoticeName.SHOW_OPEN_ZP_PANEL);
			return;
		}

		private function onPayBagHandler(event:MouseEvent):void
		{
			var _loc_2:*=facade.retrieveProxy(SwfDataProxy.NAME) as SwfDataProxy;
			_loc_2.singleLoadSWF("paybag", CLZNoticeName.SHOW_PAY_BAG_PANEL);
			return;
		}

		private function onRedBagHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.SHOW_RED);
			return;
		}

		private function onActivityHandler(event:MouseEvent):void
		{
			this.sendNotification(CLZNoticeName.NATIONAL_DAY_REQ);
			return;
		}

		private function overRoomTipHandler(event:MouseEvent):void
		{
			this.mcGameMain._mcRoomTip.alpha=1;
			return;
		}

		private function outRoomTipHandler(event:MouseEvent):void
		{
			this.mcGameMain._mcRoomTip.alpha=0.5;
			return;
		}

		override public function listNotificationInterests():Array
		{
			return [CLZNoticeName.SETROOMINFO_RSP, CLZNoticeName.RESPONSE_ROOM_INFO_SUCC, CLZNoticeName.OUT_GAME_ROOM_RSP, CLZNoticeName.DRAW_GAME, CLZNoticeName.UPDATE_SEAT_ID, CLZNoticeName.HIDE_CARD_RANK_TIP_COMPLETE, CLZNoticeName.ONLINE_TIME_NUM, CLZNoticeName.STAND_UP_RSP, CLZNoticeName.SITDOWN_RSP, CLZNoticeName.HIDE_CLOSE_ZP_PANEL];
		}

		override public function handleNotification(notification:INotification):void
		{
			var data:Object=null;
			var standOrSeat:int=0;
			var arrData:Array=null;
			var playerVo:PlayerVo=null;
			switch (notification.getName())
			{
				case CLZNoticeName.SETROOMINFO_RSP: //设置房间状态
				{
//					data=notification.getBody();
					updateRoomInfo();
					break;
				}
				case CLZNoticeName.RESPONSE_ROOM_INFO_SUCC: //设置房间状态
				{
					data=notification.getBody();
					GameData.time=data.time;
					this._isPlaying=data.isPlaying;
					this._nDealerId=data.dealer;
					if (GameData._objRoom.randomSit)
					{
						this.sendNotification(CLZNoticeName.FAST_SIT_DOWN);
					}
					break;
				}
				case CLZNoticeName.OUT_GAME_ROOM_RSP: //退出房间，移除事件及组件
				{
					data=notification.getBody();
					if (this._global.userInfo.userVo.userid == data.userid)
					{
						this._global.seatId=0;
						if (this.maskTip_mc != null)
						{
							if (this.mcGameMain.contains(this.maskTip_mc))
							{
								this.mcGameMain.removeChild(this.maskTip_mc);
								GameData.removeNumChildre(this.maskTip_mc);
								this.maskTip_mc=null;
							}
						}
						this.removeRegisterMcEvent();
						this.sendNotification(CLZNoticeName.SHOW_TOP);
					}
					break;
				}
				case CLZNoticeName.DRAW_GAME:
				{
					if (this._bitmapData == null)
					{
						this._bitmapData=new BitmapData(GameData.config["stageW"], GameData.config["stageH"], true, 0);
					}
					this._bitmapData.draw(this.mcGameMain);
					break;
				}
				case CLZNoticeName.UPDATE_SEAT_ID:
				{
					standOrSeat=notification.getBody() as int;
					if (standOrSeat == 0)
					{
						this.mcGameMain.bnt_stand.visible=false;
					}
					else
					{
						this.mcGameMain.bnt_stand.visible=true;
					}
					break;
				}
				case CLZNoticeName.HIDE_CARD_RANK_TIP_COMPLETE:
				{
					this.mcGameMain.cardHelp_btn.visible=true;
					break;
				}
				case CLZNoticeName.ONLINE_TIME_NUM:
				{
					arrData=notification.getBody() as Array;
					this._global._onLineSitTime=arrData[0];
					this._global._onLineRewardNum=arrData[1];
//					if (this._global.seatId != 0)
//					{
//						this._globalTimer.addFun(this.onlineFun);
//					}
//					else
//					{
//						this.onlineFun();
//					}
					if (this._global._onLineRewardNum > 0)
					{
						this.mcGameMain.online_btn.gotoAndStop(4);
					}
					this.initOnlineBtn();
					break;
				}
				case CLZNoticeName.STAND_UP_RSP:
				{
					data=notification.getBody();
					playerVo=this._inRoomData.getSitPlayerBySeatId(data.seatId) as PlayerVo;
					if (playerVo.userid == this._global.userInfo.userVo.userid)
					{
						this._globalTimer.removeFun(this.onlineFun);
					}
					break;
				}
				case CLZNoticeName.HIDE_CLOSE_ZP_PANEL:
				{
					this.initOnlineBtn();
					this.onlineFun();
					break;
				}
				default:
				{
					break;
				}
			}
			return;
		}

		/**
		 * 在线时长提示
		 */
		private function initOnlineBtn():void
		{
			if (this._global.userInfo.userVo.gp != GameData.QQSGAME_SID)
			{
			}
			if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
			{
				this.mcGameMain.online_btn.visible=false;
				this.mcGameMain.onlineTip_mc.visible=false;
				return;
			}
			if (this._global._onLineSitTime >= 180 * 60)
			{
			}
			if (this._global._onLineRewardNum <= 0)
			{
				this.mcGameMain.online_btn.visible=false;
				this.mcGameMain.onlineTip_mc.visible=false;
			}
			else
			{
				this.mcGameMain.online_btn.visible=true;
				this.mcGameMain.onlineTip_mc.visible=true;
			}
			this.sortBtnX();
			return;
		}

		private function onlineFun():void
		{
			trace("[GameRoom.onlineFun break]");
			return;
			var _loc_2:int=0;
			if (this.mcGameMain.online_btn.visible)
			{
			}
			if (this._global.userInfo.userVo.gp != GameData.QQSGAME_SID)
			{
			}
			if (this._global.userInfo.userVo.gp == GameData.FRIEND_SID)
			{
				return;
			}
			var _loc_1:*=int(this._global._onLineSitTime / 60);
			var _loc_3:int=0;
			if (_loc_1 < 5)
			{
				_loc_2=5 - _loc_1;
				_loc_3=1;
			}
			else if (_loc_1 < 15)
			{
				_loc_2=15 - _loc_1;
				_loc_3=1;
			}
			else if (_loc_1 < 30)
			{
				_loc_2=30 - _loc_1;
				_loc_3=2;
			}
			else if (_loc_1 < 60)
			{
				_loc_2=60 - _loc_1;
				_loc_3=2;
			}
			else if (_loc_1 < 180)
			{
				_loc_2=180 - _loc_1;
				_loc_3=3;
			}
			/*if (this._global._onLineRewardNum > 0)
			{
				this.mcGameMain.onlineTip_mc.visible=true;
				this.mcGameMain.onlineTip_mc.txt.htmlText=GameData.tip["ONLINE_TIP_1"];
			}
			else
			{
				this.mcGameMain.onlineTip_mc.visible=true;
				this.mcGameMain.onlineTip_mc.txt.htmlText=GameData.replaceStrValue(GameData.replaceStrValue(GameData.tip["ONLINE_TIP"], "TIME", _loc_2), "NUM", _loc_3);
			}*/
			this.sortBtnX();
			return;
		}

		private function sortBtnX():void
		{
			var btnTotal:int=this._arrBtn.length;
			var btnXTotal:int=this._arrBtnX.length;
			var countx:int=0;
			var count:int=0;
			while (count < btnTotal)
			{

				if (countx >= btnXTotal)
				{
					this._arrBtn[count].visible=false;
				}
				else if (this._arrBtn[count].visible)
				{
					this._arrBtn[count].x=this._arrBtnX[countx];
					countx=countx + 1;
				}
				count=count + 1;
			}
			return;
		}

		private function get mcGameMain():MovieClip
		{
			return viewComponent as MovieClip;
		}

	}
}
